#ifndef __MINIUTIL_OS_COMPATIBLE_H__
#define __MINIUTIL_OS_COMPATIBLE_H__

#ifdef WIN32

	# include <winsock2.h>
	# include <windows.h>
	typedef int socklen_t;

	#define EWOULDBLOCK WSAEWOULDBLOCK
	#ifndef strcasecmp
	#define strcasecmp _stricmp
	#endif

	#ifndef strncasecmp
	#define strncasecmp _strnicmp
	#endif

#else
	#include <sys/types.h>
	#include <sys/socket.h>
	#include <netinet/in.h>
	#include <arpa/inet.h>
	#include <netdb.h>
	#include <unistd.h>
	#include <fcntl.h>
	#include <errno.h>

	typedef int SOCKET;

	#ifndef INVALID_SOCKET
	#define INVALID_SOCKET (-1)
	#endif

	#ifdef closesocket 
	#undef closesocket
	#endif

	static inline void closesocket( SOCKET s )
	{
		::close( s );
	}

#endif

#endif
